package com.training.java.core.collections.car.pre15;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class CarCollectionDemo {

	public static void main(String[] args) {

		Car car1 = new Car("Toyota", "Camry", 2012);
		Car car2 = new Car("Nissan", "Setra", 2013);
		Car car3 = new Car("Ford", "Focus", 2011);

		car1.setPrice(17999.99);
		car2.setPrice(24999.99);
		car3.setPrice(19999.99);

		List carList = new ArrayList();
		carList.add(car1);
		carList.add(car2);
		carList.add(car3);

		Iterator ite = carList.listIterator();
		while (ite.hasNext()) {
			Car aCar = (Car) ite.next();
			System.out.println("Make:  " + aCar.getMake());
			System.out.println("Model: " + aCar.getModel());
			System.out.println("Year: " + aCar.getYear());
			System.out.println("Price: " + aCar.getPrice());
			System.out.println("************");

		}
	}
}
